const fs = require('fs')
const path = require('path')
// console.log(fs)
// console.log(__dirname, __filename)

// const filePath = path.resolve(__dirname, './files/windows.txt')
const filePath = path.resolve(__dirname, './files/1.txt')
// const filePath = path.resolve(__dirname, './files/正则测试.docx')
// const filePath = path.resolve(__dirname, './files/mac.rtf')
const ctx = fs.readFileSync(filePath, 'UTF-8')

// const reg = /\s+/g;
// console.log('1', reg.exec(ctx))
// console.log('2', reg.exec(ctx))
// console.log('3', reg.exec(ctx))
// console.log('4', reg.exec(ctx))
// console.log('5', reg.exec(ctx))
// console.log('6', reg.exec(ctx))
// console.log('7', reg.exec(ctx))
// console.log('8', reg.exec(ctx))
// console.log('9', reg.exec(ctx))
// console.log('10', reg.exec(ctx))

// const reg = /\w+/g;
const reg = /^.+$/mg;
console.log(reg.exec(ctx))
console.log(reg.exec(ctx))
console.log(reg.exec(ctx))
console.log(reg.exec(ctx))
console.log(reg.exec(ctx))
console.log(reg.exec(ctx))